<?php namespace Home\Controller;

use Hdphp\Controller\Controller;

class ContentController extends Controller{
	private $pmodel;
	private $gmodel;
	private $nmodel;
	private $spmodel;
	public function __init(){
		$this->pmodel=new \Common\Model\Product;
		$this->gmodel= new \Common\Model\Goods;
		$this->nmodel= new \Common\Model\Nature;
		$this->spmodel= new \Common\Model\Shopnature;
	}
	
	public function index(){
		$gid=Q('get.gid',0,'intval');
//		获取商品详情内容
    	$pdata = $this->pmodel->find();
		$pdata['bigdrawing']=explode('|',$pdata['bigdrawing']);
//		$pdata=$pdata->	
//		分配数据
		View::with('pdata',$pdata);
//		获取商品表的数据
		$gdata=$this->gmodel->find();
//		分配数据
		View::with('gdata',$gdata);	
//		载入模板
////		获取类型属性表的数据
//		$ndata=$this->nmodel->find();
//		$ndata['nazhi']=explode('|',$ndata['nazhi']);		
////		分配数据
//		View::with('ndata',$ndata);	


//		类型属性
		$spdata=$this->spmodel->join('nature','nature_nid','=','nid')->where("goods_gid={$gid} and natype='1'")->get();
		$sp=array();
		foreach($spdata as $k => $v){
			$sp[$v['nature_nid']][]=$v;
			
		}
		View::with('sp',$sp);

		View::make();
	}
}































 ?>